#ifndef MESSAGES_HANDLER_H
#define MESSAGES_HANDLER_H

#include <queue>
#include "Message.h"
#include "MessageCorrectPosition.h"
#include "../Socket/Socket.h"


class MessagesHandler
{
private:

	static MessagesHandler*	m_instance;
	static std::vector<Message*> m_pendingMessages;

public:
	MessagesHandler(void);
	~MessagesHandler(void);

	static MessagesHandler*	getInstance();

	void addMessage(Message* msg);
	void createMessage(ByteArray* data, bool isReceived = false, Connection* connection = NULL);
	
	void correctPos(Connection* connection, MessageCorrectPosition* msg);
	void onLogIn(Connection* connection);
	void addUnloginMsg(Connection* connection);
};

#endif